#define MIN(a,b) ((a < b) ? a : b)

int minutes(const char* t)
{
    return ((((t[0] - '0') * 10) + (t[1] - '0')) * 60 + ((t[3] - '0') * 10) + (t[4] - '0'));
}

int cmp (const void* a, const void* b)
{
    return strcmp(*(char**)a, *(char**)b);
}



int findMinDifference(char ** timePoints, int timePointsSize){
    qsort(timePoints, timePointsSize, sizeof(char*), cmp);
    int answer = 720;
    int la1 = minutes(timePoints[0]);
    int lalast = minutes(timePoints[timePointsSize - 1]);
    int temp = la1;
    for (int i = 1; i<timePointsSize; i++)
    {
        int temptemp = minutes(timePoints[i]);
        answer = MIN(answer,(temptemp - temp));
        temp = temptemp;
    }

    answer = MIN(answer,(la1 + 1440 - lalast));

    return answer;


}